package pers.yurwisher.rubick.manager.pojo.auth;

import lombok.Data;
import pers.yurwisher.rubick.common.validator.annotation.StringCheck;
import pers.yurwisher.rubick.manager.common.Constants;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * @author yq
 * @date 2020/09/18 09:29
 * @description 用户登录表单
 * @since V1.0.0
 */
@Data
public class AccessTokenForm implements Serializable {

    private static final long serialVersionUID = 3294706788927675370L;

    /**
     * 客户端ID
     */
    @NotBlank(message = "clientId 不可为空")
    private String client_id;

    /**
     * 客户端密钥
     */
    @NotBlank(message = "client_secret 不可为空")
    private String client_secret;

    /**
     * grant类型 password 密码模式 refresh_token 刷新token
     */
    @StringCheck(fieldName = "grant_type", in = {Constants.GrantType.PASSWORD, Constants.GrantType.REFRESH_TOKEN})
    private String grant_type;

    /**
     * 凭证领域
     */
    private String scope;

    /**
     * grant_type为password时必填
     */
    private String username;

    /**
     * grant_type为password时必填
     */
    private String password;

    /**
     * 刷新token凭证 当grant_type为refresh_token时必填
     */
    private String refresh_token;

}
